package 代理模式.demo1;

/**
 * 购票服务商
 * 例如： 飞猪、购票网站
 */
public class BuyerProxy implements IBuyer {
	private IBuyer buyer;

	public BuyerProxy(IBuyer buyer) {
		this.buyer = buyer;
	}

	@Override
	public void login(String username, String password) {
		this.buyer.login(username, password);
	}

	@Override
	public void buyTicket() {
		before();
		this.buyer.buyTicket();
		after();
	}

	private void after() {
		System.out.println("准备定时任务，开始刷票");
	}

	private void before() {
		System.out.println("刷票成功，通知客户");
	}
}
